<?php

namespace App\Http\Controllers\Admin;

use App\AdminUser;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class AdminUserController extends Controller
{
    public function index()
    {
        $list = AdminUser::get();

        return view('admin/users/index', ['list' => $list]);

    }


    public function addUser(Request $request)
    {
        if ($request->isMethod('post')){
            $map = $request->input();
            $rew = AdminUser::add($map);
            if($rew==200){
                return redirect('/admin/users')->with('message', '添加成功');
            }else{
                return redirect('/admin/users')->with('message', '用户已存在');
            }
        }
    }
}
